//
//  UserModel.swift
//  WalkNovel
//
//  Created by Kevin on 2023/7/4.
//

import UIKit
import HandyJSON

struct UserDetailModel: HandyJSON {
    var userId: String?
    var apple_id: String?
    var userName: String?
    var realName: String?
    var avatar: String?
    var gold: Int = 0
    var birthday: String?
    var sex: Int = 0 // 1男 2女 3保密
    var isVip: Int = 0 // 0 不是 1是
}

struct TicketModel: HandyJSON {
    var day: Int? // 天 1-7
    var gold: Int? // 可领取的金币数量
    var status: Int? // 领取状态，1不可领取，2可领取，3已领取
}

struct CommentListModel: HandyJSON {
    var total: Int = 0
    var list: [CommentDetailModel]? // 评论列表
}

struct CommentAddModel: HandyJSON {
    var comment: CommentDetailModel? // 评论
}

struct CommentDetailModel: HandyJSON {
    var avatar: String? // 用户头像
    var userName: String? // 用户名
    var comment: String? // 评论内容
    var time: String? // 时间戳秒
    
    var conHeight: CGFloat = 0 /// 评论列表Cell内容高度

    mutating func didFinishMapping() {
        if let c = comment {
            conHeight = wn_getTextH(textStr: c, font: .wn_font(name: .regular, size: 14), width: ScreenW-30) + 54
        }
    }
}

struct PayOrderModel: HandyJSON {
    var orderId: String?
}

struct RechargeDetailModel: HandyJSON {
    var currency: String?
    var productName: String?
    var productId: String?
    var goldGive: Int = 0
    var disGold: Double = 0.00
    var price: Double = 0.00
    var gold: Int = 0
    
    var orderId: String?
    var time: String?
    
    var expireTime: Int = 0 // 限时充值
    var productIds: String? // 限时充值
}

struct OrderDetailModel: HandyJSON {
    var bookId: String?
    var coverUrl: String?
    var name: String?
    var chapterId: String?
    var chapterName: String?
    var cost: Int = 0
    var time: String?
    var type: Int = 0 // 1-充值 2-抽奖 3-任务 4-签到
    var typeName: String?
    var gold: Int = 0
}

struct BalanceModel: HandyJSON {
    var gold: Int?
}

struct PositionModel: HandyJSON {
    var bookId: String? // 书Id
    var name: String? // 书名
    var coverUrl: String? // 竖图
    var authorname: String? // 作者名
    var userId: String?
    var avatar: String?
    var longitude: Double = 0.0
    var latitude: Double = 0.0
}

struct SubModel: HandyJSON {
    var isDing: Int = 0 // 0 未订阅 1已订阅
    var checkInOrNOt: Int = 0  // 0 未签到 1已签到
    var checkDay: Int = 0
    var diffDay: Int = 0
    var sub: SubDetailModel?
}

struct SubDetailModel: HandyJSON {
    var groupId: String?
    var name: String?
    var pid: String?
    var days: Int = 0
    var gold: Int = 0
    var price: Double = 0.00
    var des: String?
    var password: String?
}
